<%@page import="com.ignou.mca.datasource.DatabaseOperations"%>
<%@page import="com.ignou.mca.beans.UserVO"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="theme/style.css"
	media="screen" />
<title>OES - Payment</title>
</head>
<body>
	<div id="MainWrapper">
		<jsp:include page="header.jsp" /> 
		<div id="MainContent">
			<center>
				<br><br><br><br>
				<b><font size="2">Processing Payment..</font></b><br>
				<br>
				<%
					UserVO uvo = (UserVO) session.getAttribute("UserVO");
					if(uvo==null)
					{
						response.sendRedirect("./Login.jsp");
					}
					else
					{
						String payment = request.getParameter("examFees");
						String examId = request.getParameter("examId");
						String examName = request.getParameter("examName");
						String subjectId = request.getParameter("subjectId");
						String userName = uvo.getUserName();
						
						DatabaseOperations db = new DatabaseOperations();
						Boolean isPayDone = db.chechIfPaymentDone(Integer.parseInt(examId), userName);
						if(isPayDone==false)
						{
				%>
				<form action="Payment.do" name="fm" method="post">
					<input type="hidden" name='examFees' value='<%=payment%>'/>
					<input type="hidden" name='subjectId' value='<%=subjectId%>'/>
					<input type="hidden" name='examId' value='<%=examId%>'/>
					<input type="hidden" name='examName' value='<%=examName%>'/>
					<input type="hidden" name='userName' value='<%=userName%>'/>
					<input type="submit" name='submit' value='Proceed with payment'/>
				</form>
				<%		}
						else
						{
							out.println("<font size='2' color='red'>You have already enrolled for this exam.</font><br><br>");
							out.println("Click <a href='UserSubjects.jsp'>here</a> to go back.");
						}
					}
				%>
			</center>
			<br><br><br><br><br><br><br><br>
		</div>
		<jsp:include page="footer.jsp" />
	</div>
</body>
</html>